package mall

import (
	"e_mall_server/service"
	"github.com/gin-gonic/gin"
	"go.uber.org/zap"
)

/**
 * @Author: zhaobin
 * @Description TODO
 * @Date: 2022-05-13 14:49
 */

// GetTopNavList 获取顶部导航列表接口
func GetTopNavList(c *gin.Context) {
	topNavList, err := service.GetNavList(map[string]interface{}{"status": 1, "position": 1})
	if err != nil {
		zap.L().Error("service.GetTopNavList() failed", zap.Error(err))
		ResponseError(c, "查询顶部导航列表失败")
		return
	}
	ResponseSuccess(c, topNavList)
}

// GetMidNavList 获取中间导航列表接口
func GetMidNavList(c *gin.Context) {
	midNavList, err := service.GetMidNavList()
	if err != nil {
		zap.L().Error("service.GetTopNavList() failed", zap.Error(err))
		ResponseError(c, "查询顶部导航列表失败")
		return
	}
	ResponseSuccess(c, midNavList)
}
